<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>

<div class="block">
    
    <div class="block_head">
        <div class="bheadl"></div>
        <div class="bheadr"></div>
        <logic:lessThan name="landForm" property="landID" value="1">
            <h2>Add Land</h2>
        </logic:lessThan>
        <logic:greaterThan name="landForm" property="landID" value="0">
            <h2>Edit Land "<bean:write name="landForm" property="landID"/>"</h2>
        </logic:greaterThan>
    </div>
    <!-- .block_head ends -->
    
    <div class="block_content clearfix">
        <html:form styleId="landForm" action="admin/land.do" method="post">
            
            <logic:notEmpty name="errorMessages" >
                <div class="message errormsg">
                    <logic:iterate id="message" name="errorMessages">
                        <p><bean:write name="message"/></p>
                    </logic:iterate>
                </div>
            </logic:notEmpty>
            <logic:notEmpty name="successMessages" >
                <div class="message success">
                    <logic:iterate id="message" name="successMessages">
                        <p><bean:write name="message"/></p>
                    </logic:iterate>
                </div>
            </logic:notEmpty>
            <logic:greaterThan name="landForm" property="landID" value="0">
                <label>Land ID: </label><span class="text"><bean:write name="landForm" property="landID"/></span>
            </logic:greaterThan>
            <p>
                <html:hidden property="landID" />
                <label for="address">Address:</label><span class="required">*</span><br/>
                <html:text styleId="address" styleClass="text medium required" property="address"/>
            </p>
            <p>
                <label for="locationID">Location:</label><span class="required">*</span><br/>
                <html:select styleId="lf_locationID" property="locationID">
                    <option value="">-- Select --</option>
                    <logic:iterate id="location" name="locationList">
                        <html:option value="${location.locationID}">${location.locationName}</html:option>
                    </logic:iterate>
                </html:select>
                <label for="lf_locationID" class="error" generated="true" style="display:none;"></label>
            </p>
            <p>
                <label for="planID">Plan Laid:</label><span class="required">*</span><br/>
                <html:select styleId="lf_planID" property="planID">
                    <option value="">-- Select --</option>
                    <logic:iterate id="plan" name="planList">
                        <html:option value="${plan.planID}">${plan.planName}</html:option>
                    </logic:iterate>
                </html:select>
                <label for="lf_planID" class="error" generated="true" style="display:none;"></label>
            </p>
            <p>
                <label for="landArea">Area:</label><span class="required">*</span><br/>
                <html:text styleId="landArea" styleClass="text small required number" property="landArea"/>
                <label for="landArea" class="note">sq. foot</label>
                <label for="landArea" class="error" generated="true" style="display:none;"></label>
            </p>
            <p>
                <label for="nearByLandMarks">Near by (Landmarks):</label><span class="required">*</span><br/>
                <html:text styleId="nearByLandMarks" styleClass="text medium required" property="nearByLandMarks"/>
            </p>
            <p>
                <label for="purchasedCost">Purchased Cost:</label><span class="required">*</span><br/>
                <html:text styleId="purchasedCost" styleClass="text small required number" property="purchasedCost"/>
                <label for="purchasedCost" class="note">U.S. dollars</label>
                <label for="purchasedCost" class="error" generated="true" style="display:none;"></label>
            </p>
            <p>
                <label for="purchasedDate">Purchased Date:</label><span class="required">*</span><br/>
                <html:text styleId="purchasedDate" styleClass="text date_picker required dateISO" property="purchasedDate"/>
                <label for="purchasedDate" class="note">(yyyy-MM-dd)</label>
                <label for="purchasedDate" class="error" generated="true" style="display:none;"></label>
            </p>
            
            <hr/>
            
            <p>
                <html:submit property="action" value="Save" styleClass="submit small"/>    
                <logic:greaterThan name="landForm" property="landID" value="0">
                    <html:submit property="action" value="Save & Exit" styleClass="submit mid"/>
                    <html:link styleClass="confirm-button submit small red" action="/admin/landListing.do?action=delete" paramId="landID" paramName="landForm" paramProperty="landID">
                        Delete
                    </html:link>
                </logic:greaterThan>
                <html:link action="/admin/landListing.do" styleClass="submit small gray">Cancel</html:link>
            </p>
            
            
        </div>
        <!-- .block_content ends -->
    </html:form>
        
    <div class="bendl"></div>
    <div class="bendr"></div>
    
</div>
<!-- .block ends -->
